package sysman.user.service;

import org.apache.struts2.osgi.interceptor.BundleContextAware;

import common.dao.HibernateDao;

import sysman.user.entity.User;

import org.osgi.framework.BundleContext;

public class UserServiceImpl implements UserService, BundleContextAware {

	BundleContext bundleContext;
	
	private HibernateDao hibernateDao;
	
	public HibernateDao getHibernateDao() {
		return hibernateDao;
	}

	public void setHibernateDao(HibernateDao hibernateDao) {
		this.hibernateDao = hibernateDao;
	}
	
	public void setBundleContext(BundleContext bundleContext) {
		this.bundleContext = bundleContext;
	}

	public User getUserById(String userId) throws Exception {
		return (User) hibernateDao.get(User.class, userId);
	}
	
	public User getUserByName(String userName) {
		User user = new User();
		user.setUserName("test");
	
		return user;
	}
	
	public User saveUser(User user) {
		return user;
	}

}
